-
Notifications
You must be signed in to change notification settings - Fork 13.5k
fixed some clippy warnings in compiletest #42896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
src/tools/compiletest/src/header.rs
Outdated
let major: isize = version_string.parse().ok().expect(&error_string); | ||
return major; | ||
let major: isize = version_string.parse().expect(&error_string); | ||
major |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this can be just one line, there's no need for the variable here. I guess it does indicate what we're getting from the version, but AIUI that's not actually important -- the isize is mostly opaque.
As a side note, which is out of scope for this PR, why is this an isize? Can the version number be negative? u32 or u64 would seem to make more sense...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I did not look at that code too closely. We had clippy ignore bindings with given type because we were getting some false positives around it. However, I agree, this should be one line. I'm not going to change APIs here...
Looks like tidy may be failing as well? |
Ouch, one change brought it to 101 chars per line. Fixed. |
[00:34:05] Compiling compiletest v0.0.0 (file:///checkout/src/tools/compiletest)
[00:34:05] error[E0308]: mismatched types
[00:34:05] --> /checkout/src/tools/compiletest/src/header.rs:549:59
[00:34:05] |
[00:34:05] 549 | pub fn lldb_version_to_int(version_string: &str) -> isize {
[00:34:05] | ___________________________________________________________^
[00:34:05] 550 | | let error_string = format!("Encountered LLDB version string with unexpected format: {}",
[00:34:05] 551 | | version_string);
[00:34:05] 552 | | version_string.parse().expect(&error_string);
[00:34:05] 553 | | }
[00:34:05] | |_^ expected isize, found ()
[00:34:05] |
[00:34:05] = note: expected type `isize`
[00:34:05] found type `()`
[00:34:05] help: consider removing this semicolon:
[00:34:05] --> /checkout/src/tools/compiletest/src/header.rs:552:49
[00:34:05] |
[00:34:05] 552 | version_string.parse().expect(&error_string);
[00:34:05] | ^
[00:34:05]
[00:34:06] error: aborting due to previous error(s)
[00:34:06]
[00:34:06] error: Could not compile `compiletest`. |
@bors: r+ |
📌 Commit 7be171d has been approved by |
fixed some clippy warnings in compiletest This is mainly readability stuff. Whenever the `clone_ref` lint asked me to clone the dereferenced object, I removed the `.clone()` instead, relying on the fact that it has worked so far and the immutable borrow ensures that the value won't change.
☀️ Test successful - status-appveyor, status-travis |
This is mainly readability stuff. Whenever the
clone_ref
lint asked me to clone the dereferenced object, I removed the.clone()
instead, relying on the fact that it has worked so far and the immutable borrow ensures that the value won't change.